package lrr;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class test {
	

	public static void main(String args[]) throws IOException{
		ByteArrayOutputStream bs=new ByteArrayOutputStream();
		DataOutputStream ds=new DataOutputStream(bs);
		ds.writeInt(-200);
		byte [] buf=bs.toByteArray();
		System.out.println(buf[0]+""+buf[1]+""+buf[2]+""+buf[3]);
		ByteArrayInputStream bais=new ByteArrayInputStream(buf);
		DataInputStream dis=new DataInputStream(bais);
		int i=dis.readInt();
		System.out.println("i="+i);
		
		byte [] b=new byte[4];
		b[0]=(byte)((i>>>24)&0xff);
		b[1]=(byte)((i>>>16)&0xff);
		b[2]=(byte)((i>>>8)&0xff);
		b[3]=(byte)(i&0xff);
		System.out.println(b[0]+""+b[1]+""+b[2]+""+b[3]);
		int i1=0xff000000&b[0]<<24|0xff000000&b[1]<<16|0xff000000&b[2]<<8|0xff000000&b[3]<<0;
		System.out.println("i1="+i);
	}
}
